
#ifndef _zf_driver_dma_h_
#define _zf_driver_dma_h_

#include "ch32v30x.h"
#include "ch32v30x_gpio.h"
#include "ch32v30x_rcc.h"
#include "ch32v30x_usart.h"
#include "ch32v30x_dma.h"

#include "zf_common_interrupt.h"
#include "zf_common_debug.h"
#include "zf_driver_gpio.h"

#define DMA_CH(ch_enum)                 ((DMA_Channel_TypeDef*)ch_enum)
#define DMA_CH_SET_CPAR(ch_enum,addr)   do{DMA_CH(ch_enum)->PADDR=(addr);}while(DMA_CH(ch_enum)->PADDR!=(addr))

void dma_clock_init(DMA_Channel_TypeDef*ch);
void dma_finish_nvic_enable(DMA_Channel_TypeDef*ch,uint8 priority);
void dma_finish_nvic_disable(DMA_Channel_TypeDef*ch);
void dma_print(void);
#endif
